POV-Ray : Newsgroups : povray.advanced-users : File Read Problem : Re: File Read Problem Server Time
29 Jul 2024 18:28:25 EDT (-0400)
  Re: File Read Problem  
From: David Vincent-Jones
Date: 6 Mar 2001 12:49:54
Message: <3aa52342@news.povray.org>
Thanks guys. Your 'clue' solved the problem.......
An errant comma was not deleted at EOF so.....
Sometimes the error messages lead one to look in the wrong place !!

David

"Margus Ramst" <mar### [at] peakeduee> wrote in message
news:3aa4d98f$1@news.povray.org...
> "David Vincent-Jones" <geo### [at] galaxynetcom> wrote:
>
> > Can somebody explain to me why the following code is halting at the
second
> > read.
>
> As far as I can see, what happens is your second loop reads the last entry
> in Build.dat - but it does not close the file, because POV closes the file
> when it reads EOF. So the condition of the first while loop is still
> satisfied; the loop starts, the first #read reads EOF and closes the file.
> After this NB_File is undefined and the second #read gives an error.
>
> Here's a hack that works around the problem; it checks whether NB_File
> is still defined after the first #read; if not, it simply runs an empty
loop.
>
> #fopen NB_File "Build.dat" read
> #while (defined(NB_File))
>    #read (NB_File,Num)
>    #if(defined(NB_File))
>      #read (NB_File,Elev)
>      prism{
>        linear_sweep linear_spline
>        (Elev+5),(Elev+30)
>        Num
>        #local i=0;
>        #while (i<Num)
>          #read (NB_File, Vec)
>          Vec
>          #local i=i+1;
>        #end
>        pigment {rgb x}
>      }
>    #end
> #end
>
> --
> Margus Ramst
>
> Personal e-mail: mar### [at] peakeduee
> TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg
> Home page http://www.hot.ee/margusrt


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.